/* eslint-disable react/jsx-no-target-blank */
/**
 * title: 首页
 */
import styles from './index.css';
import { Link } from 'umi';

export default function() {
  const linkList = [
    { url: '/demo', title: 'demo', child: [{ url: './a1', title: 'demo', child: [] }] },
    { url: '/hooks', title: 'hooks' },
  ];
  return (
    <div className={styles.normal}>
      <div className={styles.welcome} />
      <ul className={styles.list}>
        {linkList.map((link, i) => {
          const { child } = link;
          const childEle =
            !!child && child.length > 0
              ? link.child.map((c, j) => {
                  return (
                    <div key={j}>
                      <Link to={c.url}>{c.title}</Link>
                    </div>
                  );
                })
              : null;
          return (
            <div key={i}>
              <Link to={link.url}>{link.title}</Link>
              {childEle}
            </div>
          );
        })}
      </ul>
    </div>
  );
}
